<template>
  <el-dialog :title="!dataForm.id ? '新建' : isDetail ? '详情' : '编辑'" :close-on-click-modal="false" :visible.sync="visible" class="cu-dialog cu-dialog_center" lock-scroll width="900px">
    <el-form ref="elForm" :model="dataForm" size="small" label-width="120px" label-position="right" :disabled="!!isDetail" :rules="rules">
      <el-row :gutter="5" type="flex" style="flex-wrap:wrap">
        <el-col :span="12" v-if="custom.hasFormP('campusId')">
          <el-form-item label="校区" prop="campusId">
            <el-select v-model="dataForm.campusId" placeholder="请选择" filterable clearable required :style="{ width: '100%' }">
              <el-option v-for="(item, index) in campusOptions" :key="index" :label="item.fullName" :value="item.id"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="12" v-if="custom.hasFormP('goodsName')">
          <el-form-item label="名称" prop="goodsName">
            <el-input v-model="dataForm.goodsName" placeholder="请输入" clearable :style="{ width: '100%' }" readonly></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12" v-if="custom.hasFormP('category')">
          <el-form-item label="类别" prop="category">
            <el-select v-model="dataForm.category" filterable clearable @change="getGoodsCategoryOptions()" disabled>
              <el-option v-for="item in goodsOptions" :key="item.value" :label="item.label" :value="item.value"></el-option>
            </el-select>
            <!--            <el-select v-model="dataForm.goodsId" placeholder="请选择" filterable clearable required
              :style='{"width":"100%"}' :disabled="dataForm.account!=null">
              <el-option v-for="(item, index) in goodsOptions" :key="index" :label="item.fullName"
                :value="item.id"></el-option>
            </el-select>-->
          </el-form-item>
        </el-col>
        <el-col :span="12" v-if="custom.hasFormP('type')">
          <el-form-item label="规格" prop="type">
            <el-select v-model="dataForm.type" placeholder="请选择规格" filterable clearable>
              <el-option v-for="item in goodsTypeOptions" :key="item.value" :label="item.label + '/' + item.unitDescribe" :value="item.value"></el-option>
            </el-select>
            <!--            <el-input v-model="dataForm.standards" placeholder="请输入" :disabled="dataForm.account!=null" clearable
              :style='{"width":"100%"}'>
            </el-input>-->
          </el-form-item>
        </el-col>
<!--        <el-col :span="12" v-if="custom.hasFormP('account')">
          <el-form-item label="帐号" prop="account">
            <el-input v-model="dataForm.account" placeholder="请输入" clearable :style="{ width: '100%' }"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12" v-if="custom.hasFormP('openDate')">
          <el-form-item label="开通日期" prop="openDate">
            <el-date-picker v-model="dataForm.openDate" placeholder="请选择" clearable required :style="{ width: '100%' }" type="date" format="yyyy-MM-dd" value-format="timestamp"></el-date-picker>
          </el-form-item>
        </el-col>
        <el-col :span="12" v-if="custom.hasFormP('startDate')">
          <el-form-item label="开始日期" prop="startDate">
            <el-date-picker v-model="dataForm.startDate" placeholder="请选择" clearable required :style="{ width: '100%' }" type="date" format="yyyy-MM-dd" value-format="timestamp"></el-date-picker>
          </el-form-item>
        </el-col>
        <el-col :span="12" v-if="custom.hasFormP('endDate')">
          <el-form-item label="截止日期" prop="endDate">
            <el-date-picker v-model="dataForm.endDate" placeholder="请选择" clearable required :style="{ width: '100%' }" type="date" format="yyyy-MM-dd" value-format="timestamp"></el-date-picker>
          </el-form-item>
        </el-col>
        <el-col :span="12" v-if="custom.hasFormP('source')">
          <el-form-item label="帐号来源" prop="source">
            <el-radio-group v-model="dataForm.source">
              <el-radio v-for="(item, index) in sourceOptions" :key="index" :label="item.id">{{ item.fullName }}</el-radio>
            </el-radio-group>
          </el-form-item>
        </el-col>
        <el-col :span="12" v-if="custom.hasFormP('price')">
          <el-form-item label="价格" prop="price">
            <el-input v-model="dataForm.price" placeholder="请输入" clearable required :style="{ width: '100%' }"></el-input>
          </el-form-item>
        </el-col>-->
        <el-col :span="24" v-if="custom.hasFormP('matheVersion')">
          <el-form-item label="数学教材版本" prop="matheVersion">
            <el-radio-group v-model="dataForm.matheVersion">
              <el-radio-button v-for="(item, index) in matheVersionOptions" :key="index" :label="item.id">{{ item.fullName }}</el-radio-button>
            </el-radio-group>

            <!-- <el-checkbox-group v-model="dataForm.matheVersion" required :style='{}'>
              <el-checkbox v-for="(item, index) in matheVersionOptions" :key="index"
                :label="item.id">{{item.fullName}}</el-checkbox>
            </el-checkbox-group> -->
          </el-form-item>
        </el-col>

        <el-col :span="24" v-if="custom.hasFormP('description')">
          <el-form-item label="备注" prop="description">
            <el-input v-model="dataForm.description" placeholder="请输入" show-word-limit :style="{ width: '100%' }" type="textarea" :autosize="{ minRows: 4, maxRows: 4 }"></el-input>
          </el-form-item>
        </el-col>
        <!-- <el-col :span="6" v-if="false">
          <el-form-item label="订单主键" prop="orderId">
            <el-input v-model="dataForm.orderId" placeholder="请输入" clearable :style='{"width":"100%"}'>
            </el-input>
          </el-form-item>
        </el-col> -->
      </el-row>
    </el-form>
    <span slot="footer" class="dialog-footer">
      <el-button @click="visible = false">取 消</el-button>
      <el-button type="primary" @click="dataFormSubmit()" v-if="!isDetail">确 定</el-button>
    </span>
  </el-dialog>
</template>
<script>
export { default } from './index.js'
</script>
